<!--
 * @Description:
 * @Author: william
 * @Date: 2024-06-20 15:42:28
 * @LastEditors: william
 * @LastEditTime: 2025-03-05 11:21:27
-->
<template>
  <el-date-picker
    v-model="dateTimeValue"
    class="nw-date-picker"
    type="datetime"
    :placeholder="getPlaceholder()"
    format="YYYY-MM-DD HH:mm:ss"
    value-format="YYYY-MM-DD HH:mm:ss"
    :clearable="clearable"
    :="$attrs"
  />
  <!-- :disabled-date="disabledDate" -->
</template>

<script setup>
const props = defineProps({
  pickerType: {
    type: String,
    default: '1' // 1-没有快捷选项，2-有今天/昨天/一周以前的快捷选项
  },
  placeholder: {
    type: String,
    default: ''
  },
  label: {
    type: String,
    default: ''
  },
  clearable: {
    type: Boolean,
    default: true
  }
})

const dateTimeValue = defineModel({
  type: String,
  default: ''
})

// const disabledDate = time => {
//   return time.getTime() > +new Date()
// }

const getPlaceholder = _ => {
  return (
    props.placeholder ||
    g_rules.zhAndEnShowMsg(g_t('public.pleaseSelect'), props.label)
  )
}
</script>

<style scoped lang="scss">
.nw-date-picker {
  width: 200px;
}
</style>
